<?php

namespace app\api\controller;

use app\common\controller\Api;
use think\Db;

class Task extends Api
{
    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';


    // 新增任务
    public function add()
    {
        $result = Db::name('cron_tasks')->insert([
            'task_name' => 'sync_data',
            'params' => json_encode(['user_id' => 1001]),
            'status' => 0,
            'max_retry' => 5,
            'timeout' => 60,
            'createtime' => time()
        ]);
        $this->success('成功',$result);
    }
}